package com.fanyouzhao.joker;

import com.fanyouzhao.joker.send.BarkSend;
import com.fanyouzhao.joker.service.*;
import java.util.HashMap;
import java.util.Map;

/**
 * author: fanyouzhao
 * date: 22:37 2021/9/5
 */
public class App {
    public static void main(String[] args){
        String token = Login.login("***", "***");
        GetUserMission.send(token);
        sleep();
        GetMissionList.send(token);
        sleep();
        GetUserInfo.send(token);
        sleep();
        Map<String, String> resMap = SignIn.signIn(token);
        String title;
        String desp;
        if (resMap==null){
            title = "鹏少资源网签到出错！";
            desp = "签到失败！\n程序出错";
        }else if(Integer.parseInt(resMap.get("code"))==0){
            title = "鹏少资源网签到成功！";
            desp = resMap.get("date")+"\n#签到成功!\n"
                    +"-获得积分:"+resMap.get("credit")+"\n"
                    +"-连续签到"+resMap.get("always")+"天\n"
                    +"-当前总积分:"+resMap.get("myCredit");
        }else if(Integer.parseInt(resMap.get("code"))==1){
            title = "鹏少资源网签到失败！";
            desp = "签到失败！\n重复签到";
        }else {
            title = "鹏少资源网签到出错！";
            desp = "签到失败！\n程序出错";
        }
        Map<String, String> sendMap=new HashMap<>();
        sendMap.put("title",title);
        sendMap.put("desp",desp);
        // ServerSend.send(sendMap);
        BarkSend.send(sendMap);
        sleep();
        System.exit(0);
    }
    public static void sleep(){
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
